import React, { Component } from "react"

export default class setState extends Component {
  add = () => {
    /*
        setState 是异步函数
    */

    // 对象式setState
    this.setState({ count: count + 1 }, () => {
      //  回调函数
    })

    // 函数式的setState
    // this.setState((state, props) => {
    //   return { count: state.count + props.count }
    // })
  }
  render() {
    return <div>setState</div>
  }
}
